# -*- coding: UTF-8 -*-
"""
@version: 1.0
@PackageName: GUI_TEST - use_window_test.py
@author: beixun
@Description: 
@since 2025/11/12 15:55
"""
import time

from pywinauto import Application

app = Application(backend="uia").start("C:\\Program Files\\Notepad++\\notepad++.exe")
time.sleep(3)

# 获取窗口
win = app.window(class_name="Notepad++")
# 对窗口操作之前要先wait,然后才能进行操作
win.wait("exists")

# 窗口恢复正常状态
win.restore()
time.sleep(3)

# 检查是否是顶级窗口
print("是否是顶级窗口: "+win.is_dialog())
time.sleep(3)

# 窗口最大化
win.maximize()
# 验证是否已经最大化
print("最大化结果: "+win.is_maximized())
time.sleep(3)

# 窗口最小化
win.minimize()
# 验证是否已经最小化
print("最小化结果: "+win.is_minimized())
time.sleep(3)

# 关闭窗口
win.close()